home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu194.dms
/
pu194.adf
/
MambaMove
/
MambaMove.lzh
/
MambaMove.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-22
|
59KB
|
1,962 lines
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <libraries/dos.h>
#include <graphics/gfx.h>
#include <clib/macros.h>
#define UP 0
#define RIGHT 1
#define DOWN 2
#define LEFT 3
#define HORIZONTAL 4
#define VERTIKAL 8
#define DIAGONAL 12
#define REVERSE 16
#define XCOORD 0
#define YCOORD 1
#define DIRECT 2
#define NO_FAULT 0L
#define NO_INTUI 1L
#define NO_GRAFX 2L
#define NO_DSCRN 3L
#define NO_ASCRN 4L
#define NO_AWIND 5L
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Screen *DataScreen, *ActionScreen;
struct Window *ActionWindow;
struct RastPort *drp, *arp;
struct ViewPort *avp;
int Score, Lives, Level, Apples;
int GrownLength, MambaLength, AnApple;
int MambaX, MambaY, MambaDir, NewD;
int MambaHead, MambaTail;
int XIn, XOut, YInt, YOut, StartDir;
int Time_Elapsed;
int am, ax, ay;
BYTE *TitleSound;
double ran();
extern USHORT ClapsSound[1150], PercoSound[2250], ShakerSound[1150];
/* extern void ClipBlit(), CloseLibrary(), Close(), FreeMem(); */
/* extern void *OpenLibrary(), *AllocMem; */
/* extern struct FileHandle *Open; */
UBYTE ScoreName[19] = "SCORE: ";
UBYTE LivesName[18] = "MAMBAS: ";
UBYTE ApplesName[18] = "APPLES: ";
UBYTE LevelName[18] = "LEVEL: ";
UBYTE TLftText[10] = "TIME LEFT";
UBYTE HiScoreHail[18] = "Mamba High Scores";
UBYTE EnterScoreHail[20] = "Enter Your Initials";
UBYTE AgainText[36] = "HIT ANY KEY OR JOYSTICK TO CONTINUE";
BYTE PlayGround[40][21], TheMamba[410][3];
int WaitIfMoved, WaitIfStruck, WaitIfTurned, WaitIfStraight, WaitOneMove;
int ProbOfTime, ProbOfGrowth, ProbOfStone, ProbOfLife, ProbOfExit;
int ThreshTime, ThreshGrowth, ThreshStone, ThreshLife, ThreshExit;
BYTE TurnMap[4][4] =
{
{ -4, 3, -1, 0},
{ 1, -3, 0, -1},
{ -1, 2, -4, 1},
{ 2, -1, 3, -3}
};
BYTE KeyTurnMap[4] =
{
3, 1, 2, 0
};
BYTE TurnRule[4][4] =
{
{ 0, 1, 0, 3},
{ 3, 0, 1, 0},
{ 0, 3, 0, 1},
{ 1, 0, 3, 0}
};
BYTE InList[20][3] =
{
{ 20, 20, 0},
{ 10, 20, 0},
{ 39, 19, 3},
{ 0, 1, 1},
{ 39, 10, 3},
{ 30, 20, 0},
{ 19, 0, 2},
{ 0, 10, 1},
{ 0, 18, 1},
{ 38, 20, 0},
{ 0, 19, 1},
{ 38, 0, 2},
{ 18, 20, 0},
{ 1, 0, 2},
{ 0, 19, 1},
{ 38, 20, 0},
{ 37, 0, 2},
{ 37, 20, 0},
{ 18, 0, 2},
{ 0, 18, 1},
};
BYTE OutList[20][2] =
{
{ 0, 10},
{ 39, 4},
{ 9, 20},
{ 0, 1},
{ 0, 10},
{ 5, 0},
{ 39, 10},
{ 37, 20},
{ 35, 0},
{ 0, 1},
{ 39, 19},
{ 0, 5},
{ 39, 10},
{ 39, 10},
{ 20, 0},
{ 20, 0},
{ 5, 20},
{ 0, 1},
{ 39, 19},
{ 39, 19}
};
BYTE AppleList[20] =
{
10, 15, 10, 10, 15,
10, 15, 7, 9, 10,
8, 10, 7, 8, 8,
10, 20, 15, 10, 15
};
BYTE ScoreNameList[8][4] =
{
"STB",
"IOU",
"COD",
"DOA",
"MAD",
"KGB",
"BND",
"..."
};
LONG ScoreList[8] =
{
1024, 512, 256, 128, 64, 32, 16, 8
};
BYTE IntroText[5][29] =
{
" Graphics & Code by ",
" Stefan Günter Boldorf ",
" ",
"© 1990 by Stefan G. Boldorf,",
" all rights reserved. ",
};
BYTE HelpText[32][34] =
{
"Try to eat all the apples without",
"hitting any of the walls, a stone",
"or yourself. The MAMBA will grow ",
"longer after you have eaten an ",
"apple or a growth pill. There are",
"some extras, which will make your",
"MAMBA'S life easier, like bonus ",
"time and lives or an extra exit! ",
"As your MAMBA moves, it burns ",
"calories and gets skinnier (just ",
"look! ). If you do not manage to ",
"get the apple in time, the number",
"of apples you have to eat will ",
"increase. This does not apply if ",
"the exit has already appeared. So",
"look out for time bonuses! ",
"To change your MAMBA'S direction ",
"use the arrow keys or a joystick ",
"in port 2. To pause the game hit ",
"<SPACE>, to end a game hit <ESC>.",
"The special items are: ",
" ",
" APPLE START FINISH LIFE ",
" TIME GATE GROWTH STONE",
"Some hints for easier survival: ",
"1. Try to move along the walls to",
" not block your own ways. ",
"2. Do not eat time bonuses until ",
" you need them. ",
"3. Avoid to encircle areas with ",
" the MAMBA. ",
" HAVE LOTS OF FUN !!! "
};
BYTE MenuText[8][27] =
{
"MAMBA MOVE SELECTION PANEL",
"¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯",
"Use arrow keys or joystick",
" ",
" Play Game ",
" Instructions ",
" High Scores ",
" Quit "
};
BYTE WaitComment[5][20] =
{
"1. WAIT IF STRUCK ",
"2. WAIT IF TURNED ",
"3. WAIT IF MOVED ",
"4. WAIT IF STRAIGHT",
"5. WAIT ONE MOVE "
};
BYTE ProbComments[5][18] =
{
"1. PROB OF A TIME",
"2. PROB OF A PILL",
"3. PROB OF A ROCK",
"4. PROB OF A LIFE",
"5. PROB OF A EXIT"
};
BYTE MambaCharSet[40] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .+-0123456789";
struct NewScreen DataScreenData =
{
0,0,
120,92,4,
0,1,
NULL,
CUSTOMSCREEN,
NULL, NULL,
NULL, NULL
};
struct NewScreen ActionScreenData =
{
0,0,
320,200,4,
0,1,
NULL,
CUSTOMSCREEN,
NULL, NULL,
NULL, NULL
};
struct NewWindow ActionWindowData =
{
0,0,
320,200,
0,0,
NULL,
ACTIVATE | BORDERLESS | RMBTRAP | NOCAREREFRESH,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
CUSTOMSCREEN,
};
UWORD MambaData[2912] = {
/* BitPlane 0 */
0xFFFF,0xFFFF,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x8C46,0x2791,0x8800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x9245,0x2492,0x8849,0x5209,0x2092,0xA478,0x0124,0x0000,
0xA17C,0xA494,0xF8DE,0x3D1B,0xD1BC,0x7A7B,0x037A,0x0000,
0xC0E0,0x7CF8,0x187F,0x3E8F,0xE8FE,0x7D7B,0x41FD,0x0000,
0xF3E0,0x7038,0x19EB,0x97BD,0x7BD7,0x2F7B,0xE7AF,0x0000,
0x927C,0xA854,0xF9C5,0x8B3C,0xB38B,0x167A,0xC796,0x0000,
0x9245,0x2492,0x89C3,0x8738,0x7387,0x0E79,0x770E,0x0000,
0x9E46,0x2311,0x89C3,0xC7B8,0x7B87,0x8F70,0xF70F,0x0000,
0xFFFF,0xFFFF,0xF9C3,0xC7B8,0x3B87,0x8F70,0xF707,0x0000,
0xBF40,0x207F,0xF9C3,0xC7B9,0xFB87,0x8F75,0x773F,0x0000,
0xA97F,0xE63E,0x39C3,0xC7B9,0xFB87,0x8F18,0xC73F,0x0000,
0xBF55,0x711D,0x79C3,0xC7B9,0xFB87,0x8F3F,0xC73F,0x0000,
0xA97F,0xE191,0x89C3,0x8738,0x7387,0x0E17,0x870E,0x0000,
0xBF55,0x60DF,0xF9C3,0x8738,0x7387,0x0E07,0x070E,0x0000,
0xA955,0x705F,0x8800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xBF7F,0xE015,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xA940,0x2516,0x0849,0x5209,0x23C7,0x89E0,0x3FE0,0x0000,
0xFFFF,0xFFFF,0xF8DE,0x3D17,0xB3C7,0x97E0,0xBFD0,0x0000,
0x807F,0xAFF0,0x087F,0x3E8F,0xFBC7,0x8FE2,0x6A48,0x0000,
0xF064,0xAA30,0x79EB,0x97AD,0xE387,0x8F82,0xBD86,0x0000,
0x9C5F,0xAFB1,0xD9C5,0x8B39,0xFBE7,0xBC02,0xDF96,0x0000,
0xF259,0x24F2,0x79C3,0x873E,0x7AC3,0x3822,0x58C8,0x0000,
0xBA79,0x24B2,0x59C3,0xC7BC,0x79CF,0x39E1,0x28BC,0x0000,
0xAF56,0x23B5,0x19C3,0xC7BC,0x79CE,0x3981,0x28AC,0x0000,
0xDD78,0x20F7,0xD9C3,0xC7BA,0x7966,0x3C00,0xE010,0x0000,
0xE940,0x2015,0x39C3,0xC78C,0xE0FE,0x0E20,0x2020,0x0000,
0xFFFF,0xFFFF,0xF9C3,0xC79F,0xE0FC,0x1FE0,0x1540,0x0000,
0x8C5C,0x2790,0xE9C3,0x870B,0x805A,0x0BE0,0x0880,0x0000,
0x8C5D,0x3CF2,0xE9C3,0x8703,0x803C,0x0380,0x0700,0x0000,
0xBF75,0x3B72,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x8C6F,0xFFFF,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xFFEF,0xE31F,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xEDF5,0x2FD2,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xF3DD,0x2312,0xE800,0x00F1,0x2412,0x5482,0x7800,0x0000,
0x9E5C,0x2310,0xE800,0x03F3,0x7A37,0x8F45,0xF800,0x0000,
0xFFFF,0xFFFF,0xF800,0x17F1,0xFD1F,0xCFA3,0xF800,0x0000,
0x9C43,0xA610,0x2800,0x1FF7,0xAF7A,0xE5E3,0xE000,0x0000,
0xD24D,0x3590,0x0800,0x1D07,0x9671,0x62CF,0x0000,0x0000,
0xFE57,0xE45E,0x7800,0x3807,0x0E70,0xE1CE,0x0800,0x0000,
0xD451,0x62D5,0x9800,0x3877,0x0F70,0xF1EE,0x7800,0x0000,
0xB467,0x63FF,0x2800,0x38F7,0x0770,0xF1EE,0x6000,0x0000,
0xA279,0xA535,0xA800,0x3CF7,0x3F70,0xF1EF,0x0000,0x0000,
0x9AC0,0x27F5,0xC800,0x1E77,0x3F70,0xF1E3,0x8800,0x0000,
0x8650,0x2517,0x0800,0x1FF7,0x3F70,0xF1E7,0xF800,0x0000,
0xFFFF,0xFFFF,0xF800,0x0FF7,0x0E70,0xE1C2,0xF800,0x0000,
0x9CDF,0x6793,0xC800,0x03C7,0x0E70,0xE1C0,0x0000,0x0000,
0xBEDF,0xEFD7,0x2800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xBBDC,0x77FB,0x9800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x9CDE,0x77BB,0x9800,0x0124,0x78F1,0x3C5D,0x0000,0x0000,
0x8EDF,0x77FB,0x9800,0x02F6,0x78F2,0xFCBD,0x8000,0x0000,
0xB7DC,0x77BB,0xD800,0x01FF,0x78F1,0xFC7F,0xC000,0x0000,
0x9FDC,0x6BD5,0xE800,0x05BC,0x70F1,0xF17B,0x0000,0x0000,
0xFFFF,0xE793,0xC800,0x073F,0x7CF7,0x81E5,0xC000,0x0000,
0xFFFF,0xFFFF,0xF800,0x07CF,0x5867,0x05C3,0xC000,0x0000,
0x8054,0xA853,0xC800,0x078F,0x39E7,0x3DCB,0xC000,0x0000,
0xA26A,0x70B7,0xA800,0x078F,0x39C7,0x31EF,0x0000,0x0000,
0x805C,0xE05B,0xD800,0x074F,0x2CC7,0x81EF,0x0000,0x0000,
0x88EA,0x605B,0x9800,0x019C,0x1FC1,0xC5EE,0x8000,0x0000,
0x8054,0xE01B,0x9800,0x03FC,0x1F83,0xFDE7,0xC000,0x0000,
0xA241,0x681B,0x9800,0x0170,0x0B41,0x7DC3,0xE000,0x0000,
0x806A,0xF435,0xA800,0x0070,0x0780,0x71C1,0xA000,0x0000,
0x88DF,0xA853,0xC800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xFFFF,0xFFFF,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x8C5C,0x2790,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x8C5F,0x3CF3,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xB371,0x3B72,0x3800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xAD6E,0xFB7D,0xD800,0x0000,0x3C3F,0x8780,0x0220,0x0000,
0xEDEE,0xEB5D,0xD800,0x0385,0x6800,0x0000,0xF434,0x0000,
0xEDF1,0x2CD2,0x3804,0xAAA0,0xD555,0x5AAA,0xAA9D,0x0000,
0xF3DF,0x2313,0xE955,0x5400,0x0000,0x0000,0x0002,0x0000,
0x9E5C,0x2310,0xE955,0x0000,0x0000,0x0000,0x0002,0x0000,
0xFFFF,0xFFFF,0xF805,0xFEAA,0x9555,0x5AAA,0xAA9D,0x0000,
0x9E5F,0x2793,0xE800,0x0385,0x6AAA,0xAD50,0xF564,0x0000,
0xAD5C,0xBCF4,0xE800,0x0000,0x3C00,0x0780,0x0220,0x0000,
0xDEF7,0x7B7B,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xD2ED,0xFFFE,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xFFED,0xF4BE,0xD800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xEDF7,0x77BB,0xB800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xF3DC,0xAB54,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x9E5F,0x2793,0xE800,0x0000,0x0000,0x0000,0x0120,0x0000,
0xFFFF,0xFFFF,0xF800,0x0A49,0x2444,0x4444,0x8488,0x0000,
0xBF5F,0xA797,0xE805,0x5524,0x9111,0x1112,0x4B9A,0x0000,
0xE1D0,0xFB7C,0x2985,0x55B6,0xD555,0x555B,0x5EF3,0x0000,
0xDEE7,0x733B,0x9985,0x55B6,0xD555,0x555B,0x5EF3,0x0000,
0xD2FD,0x77BA,0xF805,0x5524,0x9111,0x1112,0x4B9A,0x0000,
0xDEFD,0x74BA,0xF800,0x0A49,0x2444,0x4444,0x8488,0x0000,
0xCCE7,0x77BB,0x9800,0x0000,0x0000,0x0000,0x0120,0x0000,
0xEDD0,0xF87C,0x2800,0x0000,0x0000,0x0000,0x0000,0x0000,
0x9E5F,0xAFD7,0xE800,0x0000,0x0000,0x0000,0x0000,0x0000,
0xFFFF,0xFFFF,0xF800,0x0000,0x0000,0x0000,0x0000,0x0000,
/* BitPlane 1 */
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0004,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0C06,0x0703,0x006B,0x560D,0x60D6,0xAC78,0x01AC,0x0000,
0x1E07,0x0707,0x0086,0x8D10,0xD10D,0x1A4B,0x821A,0x0000,
0x3F3F,0x870F,0xE081,0x4290,0x2902,0x854A,0x6205,0x0000,
0x7FBF,0xDFEF,0xE11C,0xF9A3,0x9A39,0xF34A,0x2473,0x0000,
0x1C3F,0x8FC7,0xE136,0x8D22,0xD26D,0x1A4B,0x145A,0x0000,
0x1C07,0x0783,0x0102,0x0420,0x4204,0x0849,0x9408,0x0000,
0x1C06,0x0301,0x0102,0x44A0,0x4A04,0x8940,0x9409,0x0000,
0x0000,0x0000,0x0102,0x44A0,0x4A04,0x8940,0x9409,0x0000,
0x2100,0x01AF,0xF102,0x44A1,0x0A04,0x8941,0x9421,0x0000,
0x3B3F,0xC90F,0xF102,0x44A1,0x0A04,0x8921,0x0421,0x0000,
0x212A,0x8383,0x8102,0x44A1,0xCA04,0x8920,0x0439,0x0000,
0x3B2A,0x824F,0xF102,0x0420,0x4204,0x0818,0x0408,0x0000,
0x2100,0x010F,0xF1E3,0xC7BC,0x7BC7,0x8F06,0x078F,0x0000,
0x3B2A,0x800F,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x213F,0xD04E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3B00,0x088F,0xF06B,0x560D,0x63C7,0x8DE0,0x5550,0x0000,
0x0000,0x0000,0x0086,0x8D14,0x3244,0x9021,0x6AA4,0x0000,
0x0030,0x8860,0x0081,0x4290,0x1A44,0x9023,0xF532,0x0000,
0x703D,0x8EE0,0x711C,0xF9B0,0x0A04,0x91C3,0x30E4,0x0000,
0x6C28,0x88C1,0xA136,0x8D21,0x8A24,0xA203,0x17C4,0x0000,
0x4E03,0x0643,0xA102,0x0426,0x4B24,0x2123,0xB8E2,0x0000,
0x0E27,0x0703,0x0102,0x44A4,0x4908,0xA121,0xE020,0x0000,
0x412E,0x0346,0x2102,0x44A6,0x4908,0x21C1,0xE034,0x0000,
0x6338,0x00E4,0x3102,0x44A3,0x8988,0x2100,0xE030,0x0000,
0x7B00,0x0007,0x7102,0x4490,0x0081,0x1020,0x3060,0x0000,
0x0000,0x0000,0x0102,0x4490,0x0080,0x1020,0x18C0,0x0000,
0x0C1C,0x0840,0xE102,0x040C,0x0066,0x0C20,0x0F80,0x0000,
0x1223,0x1023,0x11E3,0xC783,0x803C,0x03C0,0x0700,0x0000,
0x2108,0x97A4,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x210C,0x5328,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x4C8C,0x4848,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x5E88,0x8844,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x40A3,0x0483,0x1000,0x02F1,0xAC1A,0xD583,0x7800,0x0000,
0x211C,0x0300,0xE000,0x0A12,0x1A21,0xA344,0x0800,0x0000,
0x0000,0x0000,0x0000,0x1012,0x0520,0x50A4,0x0800,0x0000,
0x2203,0x8600,0x2000,0x10E4,0x7347,0x3E64,0x7000,0x0000,
0x760E,0xDB80,0x2000,0x0104,0x5A4D,0xA348,0x8000,0x0000,
0x421A,0x86CE,0x5000,0x2004,0x0840,0x8108,0x4800,0x0000,
0x7414,0x034B,0xF000,0x2074,0x0940,0x9128,0x4800,0x0000,
0x2C3E,0x822A,0xA000,0x2094,0x0940,0x9128,0x7000,0x0000,
0x3629,0xC760,0x6000,0x2094,0x2140,0x9128,0x4000,0x0000,
0x1D90,0x042A,0xC000,0x1194,0x2140,0x9124,0x0800,0x0000,
0x0610,0x0747,0x0000,0x1014,0x3940,0x9124,0x0800,0x0000,
0x0000,0x0000,0x0000,0x0C14,0x0840,0x8103,0x0800,0x0000,
0x0000,0x0844,0x2000,0x03E7,0x8F78,0xF1E0,0xF000,0x0000,
0x0807,0x9028,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0B04,0x01C0,0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x8000,0x01AC,0x78F1,0xBC7F,0x0000,0x0000,
0x0807,0x01C0,0x8000,0x0286,0x4892,0x04A1,0x8000,0x0000,
0x0104,0x0000,0x0000,0x0203,0x4892,0x0480,0xC000,0x0000,
0x0304,0x13E9,0xF000,0x0601,0x4092,0x398C,0x4000,0x0000,
0x0E0C,0x0844,0x2000,0x0431,0x4494,0x4116,0x4000,0x0000,
0x0000,0x0000,0x0000,0x04C9,0x6484,0x2502,0x4000,0x0000,
0x001B,0x8FC4,0x2000,0x0489,0x2114,0x2508,0x4000,0x0000,
0x2235,0xD868,0x1000,0x04C9,0x2104,0x3928,0x4000,0x0000,
0x0023,0xD3A0,0xC000,0x0471,0x3104,0x2128,0x0000,0x0000,
0x0895,0xD220,0x8000,0x0200,0x1022,0x0528,0x8000,0x0000,
0x002B,0xD260,0x8000,0x0200,0x1002,0x0524,0xC000,0x0000,
0x223F,0xD0E0,0x8000,0x0180,0x0CC1,0x8502,0x6000,0x0000,
0x003F,0xDBE9,0x9000,0x0070,0x0780,0x79E1,0xE000,0x0000,
0x089F,0x8FC4,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0C1C,0x0840,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x1223,0x1023,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x2100,0x9324,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x210C,0x5328,0xC000,0x0000,0x3FC0,0x7F80,0x03E0,0x0000,
0x4C8C,0x4848,0xC000,0x03FA,0x9555,0x52AF,0xFA8C,0x0000,
0x4C80,0x8844,0x0007,0x5555,0xBFFF,0xF7FF,0xFF8B,0x0000,
0x40A3,0x0483,0x11AA,0xAAAA,0xAAAA,0xAAAA,0xAAA9,0x0000,
0x211C,0x0300,0xE1AA,0xAAAA,0xAAAA,0xAAAA,0xAAA9,0x0000,
0x0000,0x0000,0x0007,0x5555,0x6AAA,0xA555,0x5503,0x0000,
0x1E1F,0x0843,0xE000,0x03FA,0x9555,0x52AF,0xFA9C,0x0000,
0x3323,0x9027,0x1000,0x0000,0x3FFF,0xFF80,0x03E0,0x0000,
0x6180,0xD32C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x6D8A,0x5029,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x408A,0x5B69,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x4C80,0xD86C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x40A3,0x8CC7,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x211F,0x0783,0xE000,0x0000,0x0888,0x8880,0x01E0,0x0000,
0x0000,0x0000,0x0000,0x0ADB,0x7555,0x554D,0x8718,0x0000,
0x3F1F,0x8847,0xE005,0x5400,0x0000,0x0000,0x4C26,0x0000,
0x7FAF,0xD4AF,0xD1FA,0xAA49,0x2AAA,0xAAA4,0xA109,0x0000,
0x6D9E,0xDCED,0xE1FA,0xAA49,0x2AAA,0xAAA4,0xA109,0x0000,
0x7F83,0xDCEF,0x0005,0x5400,0x0000,0x0000,0x4C26,0x0000,
0x7383,0xDFEF,0x0000,0x0ADB,0x7555,0x554D,0x8718,0x0000,
0x739E,0xDB6D,0xE000,0x0000,0x0888,0x8880,0x01E0,0x0000,
0x52AF,0xDFEF,0xD000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x211F,0x8FC7,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
/* BitPlane 2 */
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0077,0x6E0E,0xE0EE,0xDC00,0x01DC,0x0000,
0x0000,0x0000,0x00F9,0xF31F,0x31F3,0xE670,0x83E6,0x0000,
0x0000,0x0000,0x00FE,0xFD9F,0xD9FD,0xFB73,0xA3FB,0x0000,
0x0000,0x0000,0x01FF,0x7EBF,0xEBFE,0xFD73,0xC7FD,0x0000,
0x0000,0x0000,0x01F7,0x4EBE,0xEBEE,0x9D73,0xF7DD,0x0000,
0x0000,0x0000,0x01E3,0xC7BC,0x7BC7,0x8F71,0xE78F,0x0000,
0x0000,0x0000,0x01E3,0x873C,0x73C7,0x0E78,0xE78E,0x0000,
0x0000,0x0000,0x01E3,0x873D,0xF3C7,0x0E78,0xE7BE,0x0000,
0x3F00,0x01ED,0xF1E3,0x873D,0xF3C7,0x0E7D,0xE7BE,0x0000,
0x373F,0xC060,0x01E3,0x873D,0xF3C7,0x0E3F,0xE7BE,0x0000,
0x3F3F,0xC3AF,0x71E3,0x873D,0xF3C7,0x0E3F,0xE7BE,0x0000,
0x3715,0x43CF,0x71E3,0xC7BC,0x7BC7,0x8F1F,0xC78F,0x0000,
0x3F3F,0xC18F,0x71E3,0xC7BC,0x7BC7,0x8F07,0x078F,0x0000,
0x373F,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F3F,0xC00D,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3700,0x000D,0xF077,0x6E0E,0xE000,0x0E00,0x6AB0,0x0000,
0x0000,0x0000,0x00F9,0xF31B,0xD387,0x1FC1,0xF57C,0x0000,
0x003F,0x8FE0,0x00FE,0xFD9F,0xEB87,0x1FC3,0xFFFE,0x0000,
0x703B,0x8DE0,0x71FF,0x7EBF,0xFBC7,0x1FE3,0xBF6A,0x0000,
0x7C37,0x8F61,0xF1F7,0x4EBF,0xF3E7,0x3E03,0x9F4A,0x0000,
0x3E3F,0x07A3,0xD1E3,0xC7BA,0x73E7,0xBDC3,0xF8FE,0x0000,
0x761F,0x07E3,0xF1E3,0x8738,0x71EF,0xBDC1,0xE03C,0x0000,
0x7F3E,0x03E7,0xF1E3,0x873A,0x71EF,0x3DE1,0xE03C,0x0000,
0x7F38,0x00E7,0xF1E3,0x873D,0xF1FF,0x3F00,0xE030,0x0000,
0x7700,0x0006,0xF1E3,0x871F,0xF0FF,0x1FC0,0x3060,0x0000,
0x0000,0x0000,0x01E3,0x871F,0xF0FE,0x1FC0,0x18C0,0x0000,
0x0C1C,0x0FC0,0xE1E3,0xC78F,0xE07E,0x0FC0,0x0F80,0x0000,
0x1E3F,0x1FE3,0xF1E3,0xC783,0x803C,0x03E0,0x0700,0x0000,
0x3F33,0x9867,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F33,0xD86F,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x61B3,0xCFCF,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x61B3,0x8FC7,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0x0783,0xF000,0x0301,0xDC1D,0xDB83,0x8000,0x0000,
0x3F1C,0x0300,0xE000,0x0DE3,0xE63E,0x7CC7,0xF000,0x0000,
0x0000,0x0000,0x0000,0x1FE3,0xFB3F,0xBF67,0xF000,0x0000,
0x3E03,0x8600,0x2000,0x1FF7,0xFD7F,0xDFA7,0xF800,0x0000,
0x6E0F,0xDF80,0x2000,0x1F07,0xDD7D,0xD3AF,0x8000,0x0000,
0x7E1D,0x47CE,0x7000,0x3C07,0x8F78,0xF1EF,0x7000,0x0000,
0x6C1F,0xC3CF,0xF000,0x3C87,0x8E78,0xE1CF,0x7000,0x0000,
0x3C3F,0xC3E5,0xE000,0x3CE7,0xBE78,0xE1CF,0x7800,0x0000,
0x3E39,0xC6EF,0xE000,0x3EE7,0xBE78,0xE1CF,0xC000,0x0000,
0x1F90,0x07EF,0xC000,0x1FE7,0xBE78,0xE1C7,0xF000,0x0000,
0x0610,0x06C7,0x0000,0x1FE7,0xBE78,0xE1C7,0xF000,0x0000,
0x0000,0x0000,0x0000,0x0FE7,0x8F78,0xF1E3,0xF000,0x0000,
0x1C1F,0x0000,0x0000,0x03F7,0x8F78,0xF1E0,0xF800,0x0000,
0x3E1F,0x8783,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3B1C,0x07C3,0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x1C1E,0x0783,0x8000,0x01DC,0x0001,0xC063,0x0000,0x0000,
0x0E1F,0x07C3,0x8000,0x037A,0x70E3,0xF8DE,0x8000,0x0000,
0x371C,0x0783,0xC000,0x03FD,0x70E3,0xF8FF,0x4000,0x0000,
0x1F1C,0x03C1,0xE000,0x07FF,0x78E3,0xFDFF,0xC000,0x0000,
0x0E0C,0x0000,0x0000,0x07FE,0x7CE7,0xC1F7,0x8000,0x0000,
0x0000,0x0000,0x0000,0x074E,0x7CF7,0xB9E3,0x8000,0x0000,
0x0000,0x0FC0,0x0000,0x070E,0x3DF7,0xB9EF,0x8000,0x0000,
0x0000,0x18E7,0x8000,0x074E,0x3DE7,0xBDCF,0xC000,0x0000,
0x0000,0x1063,0xC000,0x07BE,0x3FE7,0xE1CF,0x8000,0x0000,
0x0000,0x1063,0x8000,0x03FE,0x1FE3,0xF9CF,0x8000,0x0000,
0x0000,0x1023,0x8000,0x03FE,0x1FC3,0xF9C7,0x4000,0x0000,
0x0000,0x1823,0x8000,0x01FC,0x0FC1,0xF9E3,0xA000,0x0000,
0x0000,0x1C61,0x8000,0x0070,0x0780,0x7DE1,0xC000,0x0000,
0x0000,0x0FC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0C1C,0x0FC0,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x1E3F,0x1FE3,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F33,0x9867,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F33,0xD86F,0x3000,0x0000,0x3FFF,0xFF80,0x03E0,0x0000,
0x61B3,0xCFCF,0x3000,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x0000,
0x61B3,0x8FC7,0x3007,0xFFFF,0x6AAA,0xAD55,0x5517,0x0000,
0x7FBF,0x0783,0xF1FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,
0x3F1C,0x0300,0xE1FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,
0x0000,0x0000,0x0007,0xFFFF,0xFFFF,0xFFFF,0xFF9F,0x0000,
0x1E1F,0x0FC3,0xE000,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x0000,
0x3F3F,0x9FE7,0xF000,0x0000,0x3FFF,0xFF80,0x03E0,0x0000,
0x7FB3,0xD86F,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FB7,0xDB6F,0xB000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x6DB7,0xDFEF,0xB000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x61B3,0xDFEF,0x3000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0x8FC7,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F1F,0x0783,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F1F,0x8FC7,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F1F,0x8FC7,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
/* BitPlane 3 */
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x007F,0x7E0F,0xE0FE,0xFC78,0x01FC,0x0000,
0x0000,0x0000,0x00FF,0xFF1F,0xF1FF,0xFE7B,0x83FE,0x0000,
0x0000,0x0000,0x00FF,0xFF9F,0xF9FF,0xFF7B,0xE3FF,0x0000,
0x0000,0x0000,0x01FF,0xFFBF,0xFBFF,0xFF7B,0xE7FF,0x0000,
0x0000,0x0000,0x01F7,0xCFBE,0xFBEF,0x9F7B,0xF7DF,0x0000,
0x0000,0x0000,0x01E3,0xC7BC,0x7BC7,0x8F79,0xF78F,0x0000,
0x0000,0x0000,0x01E3,0xC7BC,0x7BC7,0x8F78,0xF78F,0x0000,
0x0000,0x0000,0x01E3,0xC7BD,0xFBC7,0x8F78,0xF7BF,0x0000,
0x3F00,0x01E0,0x01E3,0xC7BD,0xFBC7,0x8F7D,0xF7BF,0x0000,
0x3F3F,0xCF60,0x01E3,0xC7BD,0xFBC7,0x8F3F,0xE7BF,0x0000,
0x3F3F,0xDC20,0x01E3,0xC7BD,0xFBC7,0x8F3F,0xE7BF,0x0000,
0x3F3F,0xDC00,0x01E3,0xC7BC,0x7BC7,0x8F1F,0xC78F,0x0000,
0x3F3F,0xDE40,0x01E3,0xC7BC,0x7BC7,0x8F07,0x078F,0x0000,
0x3F3F,0xDFC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F3F,0xDFC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F00,0x0F80,0x007F,0x7E0F,0xE3C7,0x8FE0,0x7FF0,0x0000,
0x0000,0x0000,0x00FF,0xFF1F,0xF3C7,0x9FE1,0xFFFC,0x0000,
0x003F,0x8FE0,0x00FF,0xFF9F,0xFBC7,0x9FE3,0xFFFE,0x0000,
0x703F,0x8FE0,0x71FF,0xFFBF,0xFBC7,0x9FE3,0xFFFE,0x0000,
0x7C3F,0x8FE1,0xF1F7,0xCFBF,0xFBE7,0xBE03,0xFFFE,0x0000,
0x7E3F,0x07E3,0xF1E3,0xC7BE,0x7BE7,0xBDE3,0xF8FE,0x0000,
0x7E3F,0x07E3,0xF1E3,0xC7BC,0x79EF,0xBDE1,0xE03C,0x0000,
0x7F3E,0x03E7,0xF1E3,0xC7BE,0x79EF,0x3DE1,0xE03C,0x0000,
0x7F38,0x00E7,0xF1E3,0xC7BF,0xF9FF,0x3F00,0xE030,0x0000,
0x7F00,0x0007,0xF1E3,0xC79F,0xF0FF,0x1FE0,0x3060,0x0000,
0x0000,0x0000,0x01E3,0xC79F,0xF0FE,0x1FE0,0x18C0,0x0000,
0x0C1C,0x0FC0,0xE1E3,0xC78F,0xE07E,0x0FE0,0x0F80,0x0000,
0x1E3F,0x1FE3,0xF1E3,0xC783,0x803C,0x03E0,0x0700,0x0000,
0x3F3F,0x9FE7,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x3F3F,0xDFEF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0xCFCF,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0x8FC7,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7FBF,0x0783,0xF000,0x03F1,0xFC1F,0xDF83,0xF800,0x0000,
0x3F1C,0x0300,0xE000,0x0FF3,0xFE3F,0xFFC7,0xF800,0x0000,
0x0000,0x0000,0x0000,0x1FF3,0xFF3F,0xFFE7,0xF800,0x0000,
0x3E03,0x8600,0x2000,0x1FF7,0xFF7F,0xFFE7,0xF800,0x0000,
0x7E0F,0xDF80,0x2000,0x1F07,0xDF7D,0xF3EF,0x8000,0x0000,
0x7E1F,0xC7CE,0x7000,0x3C07,0x8F78,0xF1EF,0x7800,0x0000,
0x7C1F,0xC3CF,0xF000,0x3CF7,0x8F78,0xF1EF,0x7800,0x0000,
0x3C3F,0xC3EF,0xE000,0x3CF7,0xBF78,0xF1EF,0x7800,0x0000,
0x3E39,0xC7EF,0xE000,0x3EF7,0xBF78,0xF1EF,0xC000,0x0000,
0x1F90,0x07EF,0xC000,0x1FF7,0xBF78,0xF1E7,0xF800,0x0000,
0x0610,0x07C7,0x0000,0x1FF7,0xBF78,0xF1E7,0xF800,0x0000,
0x0000,0x0000,0x0000,0x0FF7,0x8F78,0xF1E3,0xF800,0x0000,
0x63A0,0xCFC7,0xE000,0x03F7,0x8F78,0xF1E0,0xF800,0x0000,
0x41A0,0x586C,0xF000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x44A3,0xD82C,0x7000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x63A1,0xD86C,0x7000,0x01FC,0x78F1,0xFC7F,0x0000,0x0000,
0x71A0,0xD82C,0x7000,0x03FE,0x78F3,0xFCFF,0x8000,0x0000,
0x48A3,0xD86C,0x3000,0x03FF,0x78F3,0xFCFF,0xC000,0x0000,
0x60A3,0xDC2E,0x1000,0x07FF,0x78F3,0xFDFF,0xC000,0x0000,
0x71B3,0xCFC7,0xE000,0x07FF,0x7CF7,0xC1F7,0xC000,0x0000,
0x0000,0x0000,0x0000,0x07CF,0x7CF7,0xBDE3,0xC000,0x0000,
0x0000,0x0007,0xE000,0x078F,0x3DF7,0xBDEF,0xC000,0x0000,
0x0000,0x0708,0x7000,0x07CF,0x3DE7,0xBDEF,0xC000,0x0000,
0x0000,0x0F8C,0x3000,0x07FF,0x3FE7,0xE1EF,0x8000,0x0000,
0x0000,0x0F8C,0x7000,0x03FE,0x1FE3,0xFDEF,0x8000,0x0000,
0x0000,0x0FCC,0x7000,0x03FE,0x1FC3,0xFDE7,0xC000,0x0000,
0x0000,0x07CC,0x7000,0x01FC,0x0FC1,0xFDE3,0xE000,0x0000,
0x0000,0x038E,0x7000,0x0070,0x0780,0x7DE1,0xE000,0x0000,
0x0000,0x0007,0xE000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x001C,0x0FC0,0xE7FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xC000,
0x003E,0x1FE1,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x1E3F,0x1FE3,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x3F3F,0x1FE3,0xF400,0x0000,0x3FFF,0xFF80,0x03E0,0x4000,
0x7FBF,0x0FC3,0xF400,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x4000,
0x7FBF,0x0783,0xF407,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
0x7FBE,0x0001,0xF5FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
0x3F1C,0x0000,0xE5FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
0x0000,0x0000,0x0407,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x4000,
0x001E,0x0FC1,0xE400,0x03FF,0xFFFF,0xFFFF,0xFFFC,0x4000,
0x003C,0x1FE0,0xF400,0x0000,0x3FFF,0xFF80,0x03E0,0x4000,
0x003C,0x1FE0,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x40B8,0x1CE0,0x7400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x73B8,0x1020,0x77FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xC000,
0x7FBC,0x0000,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x7FBC,0x0000,0xF400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x3F1E,0x0001,0xE400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0018,0x0FC0,0x6400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0030,0x1860,0x3400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0020,0x1020,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0020,0x0000,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0020,0x0000,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x40A0,0x0000,0x1400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x61B0,0x0000,0x3400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x3F18,0x0000,0x6400,0x0000,0x0000,0x0000,0x0000,0x4000,
0x0000,0x0000,0x07FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xC000
};
struct Image MambaImage = {
0, 0, /* LeftEdge, TopEdge */
114, 91, 4, /* Width, Height, Depth */
&MambaData[0], /* ImageData */
0x0F, 0x00, /* PlanePick, PlaneOnOff */
NULL /* NextImage */
};
UWORD MambaCMap[16] = { /* Colors */
0x000,0xFDA,0xA86,0x764,0xFFF,0xF00,0xB00,0x700,
0xFF0,0xCA0,0x950,0x8F0,0x6C0,0x490,0x260,0x040
};
/* ************************ Amiga Routinen *************************+ */
int
GetUserMove()
{
#asm
move.w $bfec00,d0
andi.l #$ff,d0
lsr.w #1,d0
bcc.s .do_joy
cmpi #51,d0
bhi.s .joy_end
cmpi #47,d0
bls.s .joy_end
subi #48,d0
lea _KeyTurnMap,a0
adda.l d0,a0
move.b (a0),d0
bra.s .joy_end
.do_joy move.w $dff00c,d0
btst #1,d0
beq.s .next1
moveq #1,d0
bra.s .joy_end
.next1 btst #9,d0
beq.s .next2
moveq #3,d0
bra.s .joy_end
.next2 move.w d0,d1
move.w d0,d2
andi.w #1,d0
andi.w #2,d1
asr.w #1,d1
eor.w d0,d1
beq.s .next3
moveq #2,d0
bra.s .joy_end
.next3 move.w d2,d0
move.w d2,d1
andi.w #256,d0
andi.w #512,d1
asr.w #1,d1
eor.w d0,d1
beq.s .next4
moveq #0,d0
bra.s .joy_end
.next4 moveq #5,d0
.joy_end
#endasm
}
PlaySample( Data, SampleLength, SampleRate)
UBYTE *Data;
LONG SampleLength, SampleRate;
{
#asm
lea $dff0a0,a0
move.l 8(sp),a1
move.l a1,(a0)+
move.l 12(sp),d0
move.w d0,(a0)+
move.l 16(sp),d0
move.w d0,(a0)+
move.w #64,(a0)
move.w #$8201,$dff096
#endasm
}
StopSample()
{
#asm
move.w #$f,$dff096
#endasm
}
int
LoadTitleSound()
{
struct FileHandle *fh;
int AllOk;
AllOk =0;
if ( fh = Open("raiders.sound", MODE_OLDFILE))
{
if ( TitleSound = AllocMem( 65500L, MEMF_CLEAR | MEMF_CHIP))
{
Read( fh, TitleSound, 65500L);
AllOk = 1;
}
Close( fh);
}
return( AllOk);
}
UnLoadTitleSound( Really)
int Really;
{
if ( Really == 1)
{
StopSample();
FreeMem( TitleSound, 65500L);
}
}
LoadHiScores()
{
struct FileHandle *fh;
if ( (fh = Open("Mamba.hiscores", MODE_OLDFILE)) != NULL)
{
Read( fh, ScoreNameList, 32);
Read( fh, ScoreList, 32);
Close( fh);
}
}
SaveHiScores()
{
struct FileHandle *fh;
if ( (fh = Open("Mamba.hiscores", MODE_NEWFILE)) != NULL)
{
Write( fh, ScoreNameList, 32);
Write( fh, ScoreList, 32);
Close( fh);
}
}
void
Draw_Rect( rp, x0, y0, x1, y1, col)
struct RastPort *rp;
int x0, y0, x1, y1, col;
{
SetAPen( rp, col);
RectFill( rp, x0, y0, x1, y1);
SetAPen( rp, 1);
}
void
Draw_Text( rp, x0, y0, The_Text, col)
struct RastPort *rp;
int x0, y0, col;
BYTE *The_Text;
{
SetAPen( rp, col);
Move( rp, x0, y0 +6);
Text( rp, The_Text, strlen( The_Text));
SetAPen( rp, 1);
}
int
OpenItAll()
{
int fault;
if (!(IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library",0L)))
{
fault = NO_INTUI;
}
else
{
if (!(GfxBase = (struct GfxBase *)
OpenLibrary("graphics.library",0L)))
{
fault = NO_GRAFX;
}
else
{
if (!( DataScreen = (struct Screen *)
OpenScreen( &DataScreenData)))
{
fault = NO_DSCRN;
}
else
{
if (!( ActionScreen = (struct Screen *)
OpenScreen( &ActionScreenData)))
{
fault = NO_ASCRN;
}
else
{
ActionWindowData.Screen = ActionScreen;
if (!( ActionWindow = (struct Window *)
OpenWindow( &ActionWindowData)))
{
fault = NO_AWIND;
}
else
{
arp = ActionWindow->RPort;
avp = &ActionScreen->ViewPort;
drp = &DataScreen->RastPort;
LoadRGB4( avp, MambaCMap, 16L);
DrawImage( drp, &MambaImage, 0, 0);
fault = NO_FAULT;
}
}
}
}
}
return( fault);
}
void
CloseItAll( How_Much)
int How_Much;
{
switch( How_Much)
{
case NO_FAULT: CloseWindow( ActionWindow);
case NO_AWIND: CloseScreen( ActionScreen);
case NO_ASCRN: CloseScreen( DataScreen);
case NO_DSCRN: CloseLibrary( GfxBase);
case NO_GRAFX: CloseLibrary( IntuitionBase);
}
}
/* ************************ Sonst. Routinen *************************+ */
WaitAnyPressed()
{
while( GetUserMove() == 5);
}
WaitAnyReleased()
{
while( GetUserMove() != 5);
}
PlayTitleSound( Really)
int Really;
{
if ( Really == 1)
{
PlaySample( TitleSound, 32750, 400);
}
}
void
GetAlphaInput( rp, Comment, The_Text)
struct RastPort *rp;
BYTE *Comment, *The_Text;
{
int CurrPl, TexL, CharNum, CharStart, The_Move;
BYTE CharVal, OutBuff[2];
TexL = strlen( Comment);
CharStart = (320 - TexL*8)/2;
Draw_Text( rp, CharStart, 60, Comment, 10);
TexL = strlen( The_Text);
CharStart = (320 - TexL*8)/2;
Draw_Text( rp, CharStart, 70, The_Text, 13);
CurrPl = 0;
OutBuff[1] =0;
while ((CurrPl > -1)&&(CurrPl < TexL))
{
CharVal = The_Text[ CurrPl];
CharNum = index( MambaCharSet, CharVal) - MambaCharSet;
if (( CharNum < 0)||(CharNum > 39)) CharNum = 0;
OutBuff[0] = MambaCharSet[CharNum];
Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 11);
WaitAnyReleased();
WaitAnyPressed();
The_Move = GetUserMove();
WaitAnyReleased();
switch( The_Move)
{
case 0: if (CharNum > 0)
{
CharNum --;
}
else
{
CharNum = 39;
}
The_Text[ CurrPl] = MambaCharSet[ CharNum];
break;
case 1: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 13);
CurrPl ++;
break;
case 2: if (CharNum < 39)
{
CharNum ++;
}
else
{
CharNum = 0;
}
The_Text[ CurrPl] = MambaCharSet[ CharNum];
break;
case 3: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 13);
CurrPl --;
break;
}
}
}
int
GetNumInput( rp, Comment, The_Data)
struct RastPort *rp;
BYTE *Comment;
int The_Data;
{
int CurrPl, TexL, CharNum, CharStart, The_Move, The_Buff;
BYTE CharVal, OutBuff[2], The_Text[10];
The_Buff = ( The_Data < 0)? -The_Data: The_Data;
sprintf( &The_Text[1], "%07d", The_Buff);
The_Text[0] = (The_Data < 0)? '-': '+';
TexL = strlen( Comment);
CharStart = (320 - TexL*8)/2;
Draw_Text( rp, CharStart, 60, Comment, 2);
TexL = strlen( The_Text);
CharStart = (320 - TexL*8)/2;
Draw_Text( rp, CharStart, 70, The_Text, 7);
CurrPl = 0;
OutBuff[1] =0;
while ((CurrPl > -1)&&(CurrPl < TexL))
{
CharVal = The_Text[ CurrPl];
CharNum = index( MambaCharSet, CharVal) - MambaCharSet;
if ((CharNum < 30)&&(CurrPl > 0)) CharNum = 30;
if ((CharNum < 28)&&(CurrPl == 0)) CharNum = 28;
if (CharNum > 39) CharNum = 30;
OutBuff[0] = MambaCharSet[CharNum];
Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 5);
WaitAnyReleased();
WaitAnyPressed();
The_Move = GetUserMove();
WaitAnyReleased();
switch( The_Move)
{
case 0: if (CurrPl == 0)
{
CharNum = (CharNum == 28)? 29: 28;
}
else
{
if (CharNum > 30)
{
CharNum --;
}
else
{
CharNum = 39;
}
}
The_Text[ CurrPl] = MambaCharSet[ CharNum];
break;
case 1: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 7);
CurrPl ++;
break;
case 2: if (CurrPl == 0)
{
CharNum = (CharNum == 28)? 29: 28;
}
else
{
if (CharNum < 39)
{
CharNum ++;
}
else
{
CharNum = 30;
}
}
The_Text[ CurrPl] = MambaCharSet[ CharNum];
break;
case 3: Draw_Text( rp, CharStart +CurrPl*8, 70, OutBuff, 7);
CurrPl --;
break;
}
}
return( atol( The_Text));
}
void
PlacePic( X, Y, Kind)
int X, Y, Kind;
{
int x1, y1, x2, y2;
x1 = ((Kind % 4)*9) +1;
y1 = ((Kind / 4)*9) +1;
x2 = X << 3;
y2 = (Y << 3) + 32;
ClipBlit( drp, x1, y1, arp, x2, y2, 8, 8, 0xc0);
}
void
DisplayScore()
{
sprintf( &ScoreName[7], "%06d", Score);
sprintf( &LevelName[7], "%3d", Level);
sprintf( &LivesName[7], "%3d", Lives);
sprintf( &ApplesName[8], "%2d", Apples);
Draw_Text( arp, 108, 0, ScoreName, 11);
Draw_Text( arp, 80, 8, LevelName, 12);
Draw_Text( arp, 80, 16, LivesName, 12);
Draw_Text( arp, 80, 24, ApplesName, 12);
}
void
BrickLine( LeftEdge, TopEdge, BrickLength, Direction)
int LeftEdge, TopEdge, BrickLength, Direction;
{
int x, y, t, xadd, yadd;
t = 0;
xadd = ( Direction & HORIZONTAL)? 1: 0;
yadd = ( Direction & VERTIKAL) ? 1: 0;
xadd = ( Direction & REVERSE)? -1: xadd;
yadd = ( Direction & REVERSE)? -1: yadd;
x = LeftEdge;
y = TopEdge;
while ( t < BrickLength)
{
PlacePic( x, y, 7);
PlayGround[x][y] = 2;
x += xadd;
y += yadd;
t++;
}
}
void
ClearYard()
{
int k, t;
Draw_Rect( arp, 8, 40, 311, 191, 0);
for( k=1; k < 39; k++)
for( t=1; t < 20; t++)
PlayGround[k][t] = 0;
BrickLine( 0, 0, 40, HORIZONTAL);
BrickLine( 0, 20, 40, HORIZONTAL);
BrickLine( 0, 0, 21, VERTIKAL);
BrickLine( 39, 0, 21, VERTIKAL);
}
int
TurnMamba( Old, New)
int Old, New;
{
return( (Old +New) % 4);
}
int
MambaInc( Value)
int Value;
{
return( (Value +1)%400);
}
int
MambaDec( Value)
int Value;
{
return(ABS((Value -1)%400));
}
int
MoveMamba( Direction)
int Direction;
{
int x, y, t, k, help;
int oldx, oldy, ancx, ancy;
int item, time, SmplLn, OldD;
void *Sample;
time = ( Direction == 0)? 500: 300;
NewD = TurnMamba( MambaDir, Direction);
ancx = MambaX;
ancy = MambaY;
switch ( NewD)
{
case 0: MambaY--;
break;
case 1: MambaX++;
break;
case 2: MambaY++;
break;
case 3: MambaX--;
break;
}
item = PlayGround[MambaX][MambaY];
Sample = ( item == 0)? ShakerSound: PercoSound;
SmplLn = ( item == 0)? 1150: 2250;
switch ( item)
{
case 1: Score += 10;
if (GrownLength < 400) GrownLength += 10;
DisplayScore();
case 10:
case 11:
case 14: if ( item == 14) if (GrownLength < 400) GrownLength += 10;
case 15:
case 0: PlaySample( Sample, SmplLn, time);
if ( GrownLength <= MambaLength)
{
oldx = TheMamba[MambaTail][XCOORD];
oldy = TheMamba[MambaTail][YCOORD];
PlacePic( oldx, oldy, 24);
PlayGround[oldx][oldy] = 0;
MambaTail = MambaInc( MambaTail);
oldx = TheMamba[MambaTail][XCOORD];
oldy = TheMamba[MambaTail][YCOORD];
OldD = TheMamba[MambaTail][DIRECT];
PlacePic( oldx, oldy, OldD + 16);
}
else
{
MambaLength++;
}
PlacePic( ancx, ancy, (int)(TurnMap[MambaDir][NewD] +8));
MambaDir = NewD;
if ( MambaLength > 1) TheMamba[MambaDec( MambaHead)][2] = NewD;
TheMamba[MambaHead][0] = (BYTE)MambaX;
TheMamba[MambaHead][1] = (BYTE)MambaY;
TheMamba[MambaHead][2] = (BYTE)MambaDir;
PlacePic( MambaX, MambaY, 12 +MambaDir);
PlayGround[MambaX][MambaY] = 2;
MambaHead = MambaInc( MambaHead);
break;
case 13:
case 2: Lives--;
DisplayScore();
PlaySample( ClapsSound, 1150, 300);
for ( t =0; t < 7; t++)
{
for ( k = 0; k < 2; k++)
{
PlacePic( ancx, ancy, 28+(k<<2) +MambaDir);
Delay(3);
}
for ( k = 2; k >= 0; k--)
{
PlacePic( ancx, ancy, 28+(k<<2) +MambaDir);
Delay(3);
}
}
break;
}
return( item);
}
void
SetLevel( Nr)
int Nr;
{
ClearYard();
if ( Nr > 20) Nr = 1;
switch ( Nr)
{
case 1: break;
case 2: BrickLine( 8, 10, 23, HORIZONTAL);
break;
case 3: BrickLine( 9, 10, 21, HORIZONTAL);
BrickLine( 19, 3, 15, VERTIKAL);
break;
case 4: BrickLine( 4, 4, 20, HORIZONTAL);
BrickLine( 4, 4, 10, VERTIKAL);
BrickLine( 4, 14, 20, HORIZONTAL);
BrickLine( 23, 4, 7, VERTIKAL);
break;
case 5: BrickLine( 13, 1, 7, VERTIKAL);
BrickLine( 13, 13, 7, VERTIKAL);
BrickLine( 25, 1, 7, VERTIKAL);
BrickLine( 25, 13, 7, VERTIKAL);
break;
case 6: BrickLine( 1, 9, 10, HORIZONTAL);
BrickLine( 10, 12, 8, VERTIKAL);
BrickLine( 28, 10, 11, HORIZONTAL);
BrickLine( 28, 1, 7, VERTIKAL);
break;
case 7: BrickLine( 10, 4, 12, VERTIKAL);
BrickLine( 28, 4, 12, VERTIKAL);
break;
case 8: BrickLine( 19, 1, 9, VERTIKAL);
BrickLine( 19, 11, 9, VERTIKAL);
break;
case 9: BrickLine( 11, 1, 16, VERTIKAL);
BrickLine( 22, 3, 15, VERTIKAL);
BrickLine( 33, 4, 16, VERTIKAL);
break;
case 10: BrickLine( 10, 3, 20, HORIZONTAL);
BrickLine( 10, 3, 14, VERTIKAL);
BrickLine( 10, 17, 10, HORIZONTAL);
BrickLine( 20, 10, 8, VERTIKAL);
BrickLine( 20, 10, 10, HORIZONTAL);
BrickLine( 29, 7, 4, VERTIKAL);
break;
case 11: BrickLine( 15, 3, 6, VERTIKAL);
BrickLine( 25, 3, 6, VERTIKAL);
BrickLine( 5, 8, 10, HORIZONTAL);
BrickLine( 25, 8, 10, HORIZONTAL);
BrickLine( 5, 8, 7, VERTIKAL);
BrickLine( 35, 8, 7, VERTIKAL);
BrickLine( 5, 14, 10, HORIZONTAL);
BrickLine( 25, 14, 10, HORIZONTAL);
BrickLine( 15, 14, 4, VERTIKAL);
BrickLine( 25, 14, 4, VERTIKAL);
BrickLine( 15, 18, 11, HORIZONTAL);
break;
case 12: BrickLine( 15, 3, 5, VERTIKAL);
BrickLine( 25, 3, 4, VERTIKAL);
BrickLine( 3, 7, 12, HORIZONTAL);
BrickLine( 25, 7, 12, HORIZONTAL);
BrickLine( 3, 7, 10, VERTIKAL);
BrickLine( 37, 7, 11, VERTIKAL);
BrickLine( 3, 17, 34, HORIZONTAL);
BrickLine( 6, 12, 29, HORIZONTAL);
break;
case 13: BrickLine( 12, 3, 2, HORIZONTAL);
BrickLine( 14, 3, 14, VERTIKAL);
BrickLine( 29, 3, 14, VERTIKAL);
BrickLine( 19, 3, 10, HORIZONTAL);
BrickLine( 19, 9, 10, HORIZONTAL);
BrickLine( 19, 16, 10, HORIZONTAL);
break;
case 14: BrickLine( 5, 3, 13, VERTIKAL);
BrickLine( 31, 3, 13, VERTIKAL);
BrickLine( 5, 3, 5, HORIZONTAL);
BrickLine( 12, 3, 20, HORIZONTAL);
BrickLine( 5, 8, 20, HORIZONTAL);
BrickLine( 27, 8, 5, HORIZONTAL);
BrickLine( 5, 11, 5, HORIZONTAL);
BrickLine( 12, 11, 20, HORIZONTAL);
BrickLine( 5, 16, 20, HORIZONTAL);
BrickLine( 27, 16, 5, HORIZONTAL);
break;
case 15: BrickLine( 3, 5, 6, HORIZONTAL);
BrickLine( 3, 5, 5, VERTIKAL);
BrickLine( 3, 10, 5, HORIZONTAL);
BrickLine( 8, 10, 5, VERTIKAL);
BrickLine( 3, 15, 6, HORIZONTAL);
BrickLine( 11, 5, 7, HORIZONTAL);
BrickLine( 14, 5, 11, VERTIKAL);
BrickLine( 19, 5, 11, VERTIKAL);
BrickLine( 19, 5, 7, HORIZONTAL);
BrickLine( 19, 15, 6, HORIZONTAL);
BrickLine( 25, 10, 6, VERTIKAL);
BrickLine( 28, 5, 11, VERTIKAL);
BrickLine( 30, 5, 5, HORIZONTAL);
BrickLine( 35, 5, 5, VERTIKAL);
BrickLine( 30, 9, 5, HORIZONTAL);
BrickLine( 30, 11, 5, HORIZONTAL);
BrickLine( 35, 11, 5, VERTIKAL);
BrickLine( 30, 15, 5, HORIZONTAL);
break;
case 16: BrickLine( 4, 4, 12, VERTIKAL);
BrickLine( 35, 4, 12, VERTIKAL);
BrickLine( 14, 4, 7, VERTIKAL);
BrickLine( 25, 4, 7, VERTIKAL);
BrickLine( 4, 4, 10, HORIZONTAL);
BrickLine( 25, 4, 6, HORIZONTAL);
BrickLine( 4, 16, 32, HORIZONTAL);
BrickLine( 14, 10, 12, HORIZONTAL);
break;
case 17: BrickLine( 4, 8, 9, HORIZONTAL);
BrickLine( 8, 4, 9, VERTIKAL);
BrickLine( 27, 8, 9, HORIZONTAL);
BrickLine( 31, 4, 9, VERTIKAL);
BrickLine( 16, 13, 9, HORIZONTAL);
BrickLine( 20, 9, 9, VERTIKAL);
break;
case 18: BrickLine( 10, 0, 16, VERTIKAL);
BrickLine( 28, 0, 16, VERTIKAL);
BrickLine( 19, 4, 16, VERTIKAL);
break;
case 19: BrickLine( 20, 3, 15, VERTIKAL);
BrickLine( 4, 10, 33, HORIZONTAL);
BrickLine( 5, 4, 4, HORIZONTAL);
BrickLine( 5, 4, 4, VERTIKAL);
BrickLine( 32, 4, 4, HORIZONTAL);
BrickLine( 35, 4, 4, VERTIKAL);
BrickLine( 32, 16, 4, HORIZONTAL);
BrickLine( 35, 13, 3, VERTIKAL);
BrickLine( 5, 16, 4, HORIZONTAL);
BrickLine( 5, 13, 3, VERTIKAL);
break;
case 20: BrickLine( 3, 3, 10, HORIZONTAL);
BrickLine( 3, 3, 15, VERTIKAL);
BrickLine( 3, 10, 10, HORIZONTAL);
BrickLine( 3, 17, 10, HORIZONTAL);
BrickLine( 15, 3, 10, HORIZONTAL);
BrickLine( 15, 3, 15, VERTIKAL);
BrickLine( 24, 3, 15, VERTIKAL);
BrickLine( 27, 3, 10, HORIZONTAL);
BrickLine( 27, 3, 15, VERTIKAL);
BrickLine( 36, 3, 15, VERTIKAL);
BrickLine( 30, 17, 7, HORIZONTAL);
break;
default: BrickLine( 14, 4, 16, DIAGONAL);
BrickLine( 14, 10, 16, HORIZONTAL);
Nr = 16;
break;
}
Nr--;
MambaX = InList[Nr][0];
MambaY = InList[Nr][1];
MambaDir = InList[Nr][2];
MambaLength = 1;
MambaHead = 1;
MambaTail = 0;
Apples = AppleList[Nr];
switch ( MambaDir)
{
case 0: MambaY--;
break;
case 1: MambaX++;
break;
case 2: MambaY++;
break;
case 3: MambaX--;
break;
}
TheMamba[0][XCOORD] = MambaX;
TheMamba[0][YCOORD] = MambaY;
TheMamba[0][DIRECT] = InList[Nr][2];
PlayGround[MambaX][MambaY] = 2;
PlacePic( (int)(InList[Nr][0]), (int)(InList[Nr][1]), 20);
}
void
ResetValues( HowFar)
int HowFar;
{
int t, k;
switch ( HowFar)
{
case 0: Score = 0;
Lives = 5;
Apples = 0;
Level = 1;
case 1: GrownLength = 10;
AnApple = 0;
SetLevel( Level);
DisplayScore();
break;
}
}
void
LookForPlace( item, ImageCode)
int item, ImageCode;
{
int ax, ay;
int good;
good = 0;
while ( good == 0)
{
ax = (int)(ran()*38) +1;
ay = (int)(ran()*20) +1;
if ( PlayGround[ax][ay] == 0)
{
good = 1;
PlayGround[ax][ay] = item;
PlacePic( ax, ay, ImageCode);
}
}
}
void
SetItem( zone)
int zone;
{
int item;
item = 0;
if ( zone < ThreshLife)
{
item = 10;
}
else
{
if ( zone < ThreshStone)
{
item = 11;
}
else
{
if (zone < ThreshGrowth)
{
item = 13;
}
else
{
if (zone < ThreshTime)
{
item = 14;
}
else
{
item = 15;
}
}
}
}
LookForPlace( item, item + 12);
}
void
WaitForContinue()
{
Draw_Text( arp, 20, 171, AgainText, 8);
while( GetUserMove() != 5);
while( GetUserMove() == 5);
}
int
WaitForCheat()
{
int t;
Draw_Text( arp, 20, 171, AgainText, 8);
while( GetUserMove() != 5);
while( GetUserMove() == 5);
return( GetUserMove());
}
ResetTime()
{
ClipBlit( drp, 37 , 64, arp, 164, 17, 77, 14, 0xc0);
Time_Elapsed = 0;
}
DisplayHiScores()
{
BYTE OutLine[16];
int t;
ClearYard();
Draw_Text( arp, 92, 54, HiScoreHail, 9);
for( t=0; t < 8; t++)
{
strcpy( OutLine, &ScoreNameList[t][0]);
sprintf( &OutLine[3], " %06d", ScoreList[t]);
Draw_Text( arp, 120, 74 +t*9, OutLine, 11);
}
WaitForContinue();
}
ShowInstructions()
{
int t, k, l;
SetDrMd( arp, JAM1);
l = 0;
for ( k =0; k < 4; k++)
{
ClearYard();
ClipBlit( drp, 37, 0, arp, 122, 56, 77, 32, 0xc0);
for ( t =0; t < 8; t++)
{
Draw_Text( arp, 28, 92 +t*9, &HelpText[t +(k<<3)][0], 10);
Draw_Text( arp, 29, 91 +t*9, &HelpText[t +(k<<3)][0], 8);
}
if ( k == 2)
{
PlacePic( 5, 14, 6);
PlacePic( 13, 14, 20);
PlacePic( 21, 14, 21);
PlacePic( 30, 14, 23);
PlacePic( 5, 15, 27);
PlacePic( 13, 15, 22);
PlacePic( 21, 15, 26);
PlacePic( 30, 15, 25);
}
l *= 10;
l += WaitForCheat() +1;
}
SetDrMd( arp, JAM2);
if ( l == 1234) SelectWaits();
if ( l == 1324) SelectProbs();
}
InitWaits()
{
WaitIfStruck = 2;
WaitIfTurned = -3;
WaitIfMoved = 2;
WaitIfStraight = -1;
WaitOneMove = 2700;
}
InitProbs()
{
ProbOfTime = 40;
ProbOfGrowth = 25;
ProbOfStone = 23;
ProbOfLife = 10;
ProbOfExit = 5;
}
MakeThresh()
{
ThreshTime = 10000 - ProbOfTime;
ThreshGrowth = ThreshTime - ProbOfGrowth;
ThreshStone = ThreshGrowth - ProbOfStone;
ThreshLife = ThreshStone - ProbOfLife;
ThreshExit = ThreshLife - ProbOfExit;
}
GetHiScore( TheScore)
int TheScore;
{
int ok, t, k;
BYTE The_Name[4];
ClearYard();
strcpy( The_Name, "AAA");
GetAlphaInput( arp, "PLEASE ENTER YOUR NAME", The_Name);
t = 0;
while((TheScore <= ScoreList[t])&&( t < 7))
{
t++;
}
k = 7;
while (( k > t)&&(k > 0))
{
strncpy( &ScoreNameList[k][0], &ScoreNameList[k -1][0], 3);
ScoreList[k] = ScoreList[ k -1];
k--;
}
strncpy( &ScoreNameList[t][0], The_Name, 3);
ScoreList[t] = TheScore;
for (k =0; k < 3; k++)
{
if (ScoreNameList[t][k] == 0)
{
ScoreNameList[t][k] = 32;
}
}
ScoreNameList[t][3] = 0;
}
SelectWaits()
{
int WaitTimes[5];
int l;
WaitTimes[0] = WaitIfStruck;
WaitTimes[1] = WaitIfTurned;
WaitTimes[2] = WaitIfMoved;
WaitTimes[3] = WaitIfStraight;
WaitTimes[4] = WaitOneMove;
for (l = 0; l < 5; l++)
{
ClearYard();
WaitTimes[l] = GetNumInput( arp, &WaitComment[l][0], WaitTimes[l]);
}
WaitIfStruck = WaitTimes[0];
WaitIfTurned = WaitTimes[1];
WaitIfMoved = WaitTimes[2];
WaitIfStraight = WaitTimes[3];
WaitOneMove = WaitTimes[4];
ClearYard();
}
SelectProbs()
{
int ProbTimes[5];
int l;
ProbTimes[0] = ProbOfTime;
ProbTimes[1] = ProbOfGrowth;
ProbTimes[2] = ProbOfStone;
ProbTimes[3] = ProbOfLife;
ProbTimes[4] = ProbOfExit;
for (l = 0; l < 5; l++)
{
ClearYard();
ProbTimes[l] = GetNumInput( arp, &ProbComments[l][0], ProbTimes[l]);
}
ProbOfTime = ProbTimes[0];
ProbOfGrowth = ProbTimes[1];
ProbOfStone = ProbTimes[2];
ProbOfLife = ProbTimes[3];
ProbOfExit = ProbTimes[4];
MakeThresh();
ClearYard();
}
int
MambaMenu()
{
int t, KeyStroke;
KeyStroke = 7;
while ((KeyStroke != 0)&&(KeyStroke != 3))
{
ClearYard();
ClipBlit( drp, 37, 0, arp, 122, 56, 77, 32, 0xc0);
for ( t =0; t < 8; t++)
{
Draw_Text( arp, 56, 96 +t*8, &MenuText[t][0], 11);
}
for ( t = 0; t < 4; t++)
{
PlacePic( 16, 12 +t, t);
}
WaitAnyPressed();
KeyStroke = GetUserMove();
WaitAnyReleased();
switch (KeyStroke)
{
case 1: ShowInstructions();
break;
case 2: DisplayHiScores();
break;
case 0:
case 3: break;
default: KeyStroke = 7;
}
}
WaitAnyReleased();
return( (KeyStroke == 0)? 1: 0);
}
main()
{
int help, t, t_continue;
int KeyStroke, TurnJob;
int NewLevel, DoContinue;
int TitleFlag, OpenState;
if ((OpenState = OpenItAll()) == 0)
{
Draw_Rect( arp, 0,0, 319, 10, 0);
Draw_Text( arp, 167, 8, TLftText, 8);
ClipBlit( drp, 37, 0, arp, 0,0, 77, 32, 0xc0);
ClipBlit( drp, 37, 0, arp, 242, 0, 77, 32, 0xc0);
BrickLine( 0, 0, 40, HORIZONTAL);
BrickLine( 0, 20, 40, HORIZONTAL);
BrickLine( 0, 0, 21, VERTIKAL);
BrickLine( 39, 0, 21, VERTIKAL);
ResetValues( 0);
InitWaits();
InitProbs();
MakeThresh();
DisplayScore();
ResetTime();
LoadHiScores();
TitleFlag = LoadTitleSound();
PlayTitleSound( TitleFlag);
ClipBlit( drp, 37, 0, arp, 122, 56, 77, 32, 0xc0);
for ( t =0; t < 5; t++)
{
Draw_Text( arp, 48, 91 + t*9, &IntroText[t][0], 12);
}
WaitForContinue();
DoContinue = 1;
while ( DoContinue == 1)
{
Lives = 5;
PlayTitleSound( TitleFlag);
DoContinue = MambaMenu();
StopSample();
while (( Lives >= 0)&&( DoContinue == 1))
{
ResetValues( 0);
NewLevel = 1;
while ( Lives >= 0)
{
if ( NewLevel == 0)
{
if ( Level > 20) Level =1;
ResetValues( 1);
NewLevel = 1;
}
if ( AnApple == 0)
{
LookForPlace( 1, 6);
AnApple = 1;
ResetTime();
}
if ((am = (int)(ran()*10000)) > ThreshExit)
{
SetItem( am);
}
t = 0;
KeyStroke = 0;
TurnJob = 0;
help = 0;
while (t < WaitOneMove)
{
if ( TurnJob == 0)
{
KeyStroke = GetUserMove();
if (( KeyStroke >= 0)&&(KeyStroke < 5))
{
TurnJob = TurnRule[MambaDir][KeyStroke];
if ( TurnJob == 0)
{
t += WaitIfStraight;
}
else
{
t += WaitIfTurned;
}
t += WaitIfMoved;
}
t += WaitIfStruck;
}
t++;
}
Time_Elapsed++;
if ( TurnJob == 0)
{
if (KeyStroke == 63)
{
WaitAnyReleased();
WaitAnyPressed();
}
else
{
if (KeyStroke == 58)
{
Lives = -1;
}
}
}
help = MoveMamba( TurnJob);
switch (help)
{
case 1: AnApple = 0;
Apples--;
DisplayScore();
if (Apples == 0)
{
PlacePic( (int)(OutList[Level -1][0]),
(int)(OutList[Level -1][1]),
21);
PlayGround[OutList[Level -1][0]]
[OutList[Level -1][1]] = 5;
AnApple = 1;
ResetTime();
}
break;
case 5: Level ++;
Lives ++;
NewLevel = 0;
break;
case 13:
case 2: ResetValues( 1);
break;
case 10: NewLevel = 0;
Level++;
break;
case 11: Lives++;
DisplayScore();
break;
case 15: ResetTime();
break;
}
if ( Time_Elapsed > 154)
{
Time_Elapsed = 0;
ClipBlit( drp, 37, 64, arp, 164, 17, 77, 14, 0xc0);
Apples ++;
DisplayScore();
}
else
{
ClipBlit( drp, 37, 77, arp, 164, 17,(Time_Elapsed >> 1), 14,
0xc0);
}
StopSample();
}
ClipBlit( drp, 37, 32, arp, 122, 90, 77, 32, 0xc0);
WaitAnyReleased();
WaitForContinue();
if ( Score > ScoreList[7])
{
GetHiScore( Score);
}
DisplayHiScores();
}
}
UnLoadTitleSound( TitleFlag);
SaveHiScores();
}
CloseItAll( OpenState);
}